<div class="heading">
    <div class="left_heading"></div>
                                
    <div class="content_heading">
        <h3>Quản lý tour</h3>
    </div>
                                
    <div class="right_heading"></div>
</div><!-- End .heading -->

<div class="main_content">
    <div class="table_form">
        <form class="search_form" name="search_form" action="tour/search" method="get">
        Tìm kiếm: 
        <input class="input" type="text" name="keyword" value="<?php echo $this->searchValue; ?>" />
        <input class="button" type="submit" name="search" value="Tìm kiếm" />
        <span class="msg"><?php echo $this->errorSearch; ?></span>
        </form>
        
        <form class="list_cat_form" action="" method="post">
        <div style="float: right;">
        	<p id="add_form">Số lượng: <span class="msg"><?php echo $this->total; ?></span> tour</p>
	        <?php echo $this->formSubmit('add', 'Thêm mới', array('class' => 'button', 'id' => 'add_form')); ?>
            <?php echo $this->formSubmit('refresh', 'Làm mới', array('class' => 'button', 'id' => 'add_form')); ?>
	        <?php echo $this->formSubmit('delete', 'Xóa', array('class' => 'button', 'id' => 'del_form', 'onclick' => 'return remove_alert()')); ?>
        </div>                   
        <table class="table_style">
            <tr class="head_table">
                <td width="150px">Tên tour</td>
                <td width="200px">Điểm Khởi Hành</td>
                <td width="200px">Điểm Kết Thúc</td>
                <td width="150px">Ngày Bắt Đầu</td>
                <td width="150px">Ngày Kết Thúc</td>
                <td width="150px">Giá Người Lớn (VNĐ)</td>
                <td width="150px">Giá Trẻ Em (VNĐ)</td>
                <td width="150px">Loại Tour</td>
                <td width="150px">Ngày Đăng</td>
                <td class="tools">&nbsp;</td>
                <td class="tools">&nbsp;</td>
                <td class="tools"><?php echo $this->formCheckbox('check_all', null, array('id' => 'check_all', 'onClick' => 'checkAll()')); ?></td>
            </tr>
            <?php
                if(count($this->data) > 0) :
                $common = new Admin_Model_Common();
                foreach($this->data as $value) :
                $sql_date = strtotime($value['start_date']);
                $start_date = date('d/m/Y', $sql_date);
                $sql_date = strtotime($value['finish_date']);
                $finish_date = date('d/m/Y', $sql_date);
                $sql_date = strtotime($value['create_date']);
                $create_date = date('d/m/Y', $sql_date);
            ?>
            
            <?php
            $place=new Admin_Model_Place();
            $cat= new Admin_Model_Category();
            ?>
            
            
            <tr class="records">
            	
                <td><?php echo $value['tour_name']; ?></td>
                <td><?php echo $place->getPlaceNameById($value['start_place']);?></td>
                <td><?php echo $place->getPlaceNameById($value['finish_place']);?></td>
                <td><?php echo $start_date;?></td>
                <td><?php echo $finish_date;?></td>
                <td><?php echo $common->formatMoney($value['adult_price']);?></td>
                <td><?php echo $common->formatMoney($value['children_price']);?></td>
                <td><?php echo $cat->getCatNameById($value['cat_id']);?></td>
                <td><?php echo $create_date;?></td>
                <td><a class="edit" title="Sửa" href="<?php echo $this->baseUrl('/admin/tour/edit?tour_id=' . $value['tour_id']); ?>"></a></td>
                <td><a class="remove" title="Xóa" onclick="return remove_alert()" href="<?php echo $this->baseUrl('/admin/tour/delete?tour_id=' . $value['tour_id']); ?>"></a></td>
                <td><?php echo $this->formCheckbox('check[]', $value['tour_id']); ?></td>
            </tr>
            <?php 
                endforeach;
                else :
            ?>
            <tr class="records">
            	<td colspan="12">Hiện không có tour nào</td>
            </tr>
            <?php endif; ?>
        </table>
        </form>
    </div>
    
    <div class="pagination">
        <?php echo $this->paginationControl($this->data, 'Sliding', 'tour/pagination.phtml'); ?>
    </div>
    
    <?php
    echo $sp['place_name'];
    //echo $splace;
    echo "</br>";
    //vardump $sp;
    
    ?>
</div><!-- End .main_content -->  